package com.azhe.demo.controller;

import com.azhe.demo.service.DemoService;
import com.azhe.myframework.annotation.MyAutowired;
import com.azhe.myframework.annotation.MyController;
import com.azhe.myframework.annotation.MyRequestMapping;
import com.azhe.myframework.annotation.MyRequestParam;

/**
 * Description:
 *
 * @author Linzr
 * @version V1.0.0
 * @date 2021/1/8 11:04 上午
 * @since V1.0.0
 */
@MyController
@MyRequestMapping("/demo")
public class DemoController {

    @MyAutowired
    private DemoService demoService;

    @MyRequestMapping("/print")
    public String print(@MyRequestParam("name") String name) {
        return demoService.print(name);
    }

    @MyRequestMapping("/add")
    public String add(@MyRequestParam("a") Integer a,
                      @MyRequestParam("b") Integer b) {
        return a + "+" + b + "=" + demoService.add(a, b);
    }

    @MyRequestMapping("/sub")
    public String sub(@MyRequestParam("a") Double a,
                      @MyRequestParam("b") Double b) {
        return a + "-" + b + "=" + demoService.sub(a, b);
    }

}
